/*
 * Copyright 2011 Subhabrata Ghosh <subho.ghosh at langene.net>.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */



package net.langene.nlp.training.processors;

//~--- non-JDK imports --------------------------------------------------------

import net.langene.nlp.model.EnumPosType;
import net.langene.nlp.model.Sentence;
import net.langene.nlp.model.Token;

//~--- classes ----------------------------------------------------------------

/**
 *
 * @author Subhabrata Ghosh <subho.ghosh at langene.net>
 */
public class BasicCorrelationProcessor implements Processor {

    /** Field description */
    public static final String	_RELATION_TYPE_SRC_ = "SOURCE";

    /** Field description */
    public static final String	_RELATION_TYPE_TGT_ = "TARGET";

    //~--- methods ------------------------------------------------------------

    @Override
    public void setup() throws Exception {

        // Nothing required to be setup.
    }

    @Override
    public void process(Sentence sentence) throws Exception {
        if ((sentence == null) || (sentence.getTokens() == null)
                || (sentence.getTokens().size() <= 0)) {
            throw new Exception("Invalid sentence. Sentence is NULL or doesn't have any tokens.");
        }

        for (int ii = 0; ii < sentence.getTokens().size(); ii++) {
            Token	tk = sentence.getTokens().get(ii);

            if ((tk.getPos().type() == EnumPosType.ENTITY)
                    || (tk.getPos().type() == EnumPosType.ENTITY_ACTION)) {
                analyzeEntityTag(sentence, tk, ii);
            }

            if ((tk.getPos().type() == EnumPosType.ACTION)
                    || (tk.getPos().type() == EnumPosType.ENTITY_ACTION)) {
                analyzeActionTag(sentence, tk, ii);
            }
        }
    }

    private void analyzeEntityTag(Sentence sentence, Token tk, int index) throws Exception {}

    private void analyzeActionTag(Sentence sentence, Token tk, int index) throws Exception {}

    @Override
    public void dispose() {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}


//~ Formatted by Jindent --- http://www.jindent.com
